//
//  WeiBoCell.m
//  cityStar
//
//  Created by wangjia on 15/3/28.
//  Copyright (c) 2015年 tiny. All rights reserved.
//

#import "WeiBoCell.h"
#import "UIImageView+WebCache.h"
#import "DateUtil.h"

@implementation WeiBoCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setValueWithValue:(weiBoList *)weiBo{
    NSString *strImageUrl = [@"" stringByAppendingFormat:@"http://api.icszx.com/image/c/id/%@/w/400/h/200/m/1",weiBo.avatar];
    [self.imgAv sd_setImageWithURL:[NSURL URLWithString:strImageUrl] placeholderImage:nil options:SDWebImageLowPriority|SDWebImageRetryFailed];
    
    self.lblName.text = weiBo.creator_name;
    self.lblContent.text = weiBo.content;
    self.lblTime.text = [DateUtil getTimeWithChuo:weiBo.create_time];
    
    if ([weiBo.image isKindOfClass:[NSArray class]] && weiBo.image.count > 0) {
        self.imgContent.hidden = NO;
        strImageUrl = [@"" stringByAppendingFormat:@"http://api.icszx.com/image/c/id/%@/w/400/h/200/m/1",weiBo.image[0]];
        [self.imgContent sd_setImageWithURL:[NSURL URLWithString:strImageUrl] placeholderImage:nil options:SDWebImageLowPriority|SDWebImageRetryFailed];
    }else{
        self.imgContent.hidden = YES;
    }
}

@end
